<template>
  <div>
    <el-input
      placeholder="请输入内容"
      suffix-icon="el-icon-search "
      v-model="search"
      @keyup.enter.native="searchinput"
    ></el-input>
    <el-date-picker
      v-model="value1"
      type="date"
      placeholder="选择入住时间"
      :picker-options="pickerOptions0"
    ></el-date-picker>
    <el-date-picker
      v-model="value2"
      type="date"
      placeholder="选择离店时间"
      :picker-options="pickerOptions0"
    ></el-date-picker>
    <el-input
      placeholder="人数"
      suffix-icon="el-icon-user-solid "
      v-model="searchuser"
    ></el-input>
    <el-button type="primary" @click="searchinput">查看价格</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: "", //搜所酒店
      searchuser: 2, //入住人数
      value1: new Date(),
      value2: new Date(),
      TextTitle: "", //传递的参数
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now();
        },
      },
    };
  },
  mounted() {
    this.TextTitle = this.$route.params.title;
    this.search = this.$route.params.title;
  },
  methods: {
    // 搜索狂回车事件
    searchinput() {
      if (this.search) {
        this.$router.push("/listHotel/" + this.search);
        history.go(0)
      } else {
        alert("请输入要搜索的地点");
      }
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/ .el-input {
  width: 220px;
}
</style>